<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;

class CacheController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function clear()
    {
        $keys = [
            'cache:configs',
            'cache:navs',
            'cache:adv',
            'cache:category',
            'cache:banner',
            'cache:tags',
        ];
        foreach ($keys as $key) {
            Cache::forget($key);
        }

        // Cache::flush(); // 清除所有的缓存数据（不建议使用）
        return $this->successful([], '缓存已清除');
    }
}
